package org.zhxy.core.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.zhxy.entity.system.Role;

import java.util.List;

@Mapper
public interface RoleMapper extends BaseMapper<Role> {


    @Select("SELECT r.* FROM pe_permission p , pe_role r,pe_role_permission rp WHERE p.id = rp.permission_id AND rp.role_id = r.id AND p.id = #{id}")
    List<Role> getRoleListByPermissionId(String id);

    @Select("SELECT r.* FROM pe_user u,pe_user_role ur,pe_role r WHERE u.id = ur.user_id And ur.role_id = r.id And u.id = #{id}")
    List<Role> getRoleListByUserId(String id);
}
